import { array } from 'vue-types'

import type { ICreateMenuReq } from '@/apis'

import type MenuDialog from './MenuDialog'

export const menuDialogProps = () => ({
  statusOptions: array<OptionItem>().def([])
})

export const formData = (): ICreateMenuReq => ({
  parentId: '0',
  path: '',
  component: '',
  redirect: '',
  isCache: '0',
  menuType: 'M',
  menuName: '',
  orderNum: 0,
  visible: '0',
  perms: '',
  status: '0',
  icon: ''
})

/**
 * 菜单类型选项
 */
export const menuTypeOptions = [
  { label: '目录', value: 'M' },
  { label: '菜单', value: 'C' },
  { label: '按钮', value: 'F' }
] as OptionItem[]

/**
 * 菜单缓存选项
 */
export const cacheOptions = [
  { label: '缓存', value: '0' },
  { label: '不缓存', value: '1' }
] as OptionItem[]

/**
 * 菜单显示选项
 */
export const visibleOptions = [
  { label: '显示', value: '0' },
  { label: '隐藏', value: '1' }
] as OptionItem[]

export type IFormData = ICreateMenuReq
export type MenuDialogRef = InstanceType<typeof MenuDialog>
